HDFS-15963. Unreleased volume references cause an infinite loop.#2889
HDFS-15963. Unreleased volume references cause an infinite loop.#2889Hexiaoqiao merged 5 commits intoapache:trunkfrom
Conversation
|
💔 -1 overall
This message was automatically generated. |
fd41b65 to
c81875c
Compare
c81875c to
fa37c6a
Compare
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
| } catch (RuntimeException re) { | ||
| int afterCnt = vol.getReferenceCount(); | ||
| assertEquals(beforeCnt, afterCnt); | ||
| re.printStackTrace(); |
There was a problem hiding this comment.
printing the stack trace is redundant here. let's remove it?
There was a problem hiding this comment.
Ok, I'll remove it.
| } | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
We should add a timeout (a class-wide timeout is preferred) here.
There was a problem hiding this comment.
Thanks, I'll add it.
...va/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskAsyncLazyPersistService.java
Show resolved
Hide resolved
...fs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
Show resolved
Hide resolved
...in/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetAsyncDiskService.java
Show resolved
Hide resolved
| int afterCnt = volume.getReferenceCount(); | ||
| assertEquals(beforeCnt, afterCnt); | ||
|
|
||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
If it interrupts, let it throw. No need to handle the exception.
There was a problem hiding this comment.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
| Assert.assertTrue( | ||
| beforeCnts[i] == afterCnt || beforeCnts[i] == (afterCnt - 1)); | ||
| } | ||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
no need to handle the interruption
There was a problem hiding this comment.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
| } | ||
|
|
||
| @Test | ||
| public void testReleaseVolumeRefIfExceptionThrown() throws IOException { |
There was a problem hiding this comment.
It would be great if we could rewritten this test as a true unit test: A BlockSender with mocks. However, given the dependency on the DataNode class, I recognize this is not trivial.
...-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDataTransferProtocol.java
Show resolved
Hide resolved
|
Failed junit tests have nothing to do with this PR. I ran them locally and all of them passed. |
jojochuang
left a comment
There was a problem hiding this comment.
Looks almost ready. Just nits in the test.
| Assert.assertTrue( | ||
| beforeCnts[i] == afterCnt || beforeCnts[i] == (afterCnt - 1)); | ||
| } | ||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
| int afterCnt = volume.getReferenceCount(); | ||
| assertEquals(beforeCnt, afterCnt); | ||
|
|
||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
|
💔 -1 overall
This message was automatically generated. |
|
Please fix the spotbugs warning. Other than that I am +1. |
|
Thanks @zhangshuyan0 for your great catch here. LGTM. +1 from my side. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
Hexiaoqiao
left a comment
There was a problem hiding this comment.
The failed unit tests seem not related to this PR. +1.
@jojochuang do you mind give double check? I think it is ready to commit this PR. anymore suggestions? Thanks.
|
@jojochuang Hi Wei-Chiu, any furthermore comment here? If not, I would like to commit this PR shortly. Thanks. |
|
Go ahead. Thanks! |
|
Committed to trunk. Thanks @zhangshuyan0 for your works! Thanks @jojochuang for your reviews! |
…che#2889) Contributed by Shuyan Zhang. Reviewed-by: Wei-Chiu Chuang <weichiu@apache.org> Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
…che#2889) Contributed by Shuyan Zhang. Reviewed-by: Wei-Chiu Chuang <weichiu@apache.org> Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
This patch releases the three previously unreleased volume references.